<template>
	<div>
		<van-nav-bar title="京东注册" left-text="返回" left-arrow @click-left="$router.go(-1)" />

		<van-form @submit="onSubmit">
			<van-cell-group inset>
				<van-field v-model="password" name="password" label="请输入密码" :rules="[{ pattern, message: '请填写规定的密码' }]" />
			</van-cell-group>
			<div style="margin: 16px;">
				<van-button round block type="primary" native-type="submit"
					color="linear-gradient(to right, #ff6034, #ee0a24)">
					下一步
				</van-button>
			</div>
		</van-form>
	</div>
</template>

<script setup lang='ts'>
import { Succeed } from '../api/loginapi'

import { ref, type Ref } from 'vue';
import { useRouter,useRoute } from 'vue-router';


const router = useRouter()
const route = useRoute()

const password: Ref<string> = ref('')
const pattern = /^(?=.{6})(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[*?!&￥$%^#,./@";:><\[\]}{\-=+_\\|》《。，、？’‘“”~ `]).*$/;


const onSubmit = () => {
	Succeed({password:password.value,tel:(route.query.tel) as string}).then((res:any)=>{
		if(res.code==200){
			router.push('/login')
			
		}
	})
}

</script>

<style scoped>

</style>